<?php
/*	##################################################################
	Proyecto: Parque Las Aves
	################################################################## */

	include ("common/cabecera.php"); 
	
    // Conectamos con la base de datos
	$conn = conectarBBDD();
	
	$ave = new Ave ();
	
	$datosAves = $ave -> obtenerListadoAves ($conn);
?>
<script language="JavaScript" type="text/javascript">
	function returnRefresh(returnVal) {
	  window.top.location.href="listado.php";
	}
</script> 
<div id="contenido2" class="clearfix">
        <?php
				if (count($datosAves) == 0) {
				    echo "<table cellpadding='2' cellspacing='2'>";
					echo "<tr>";
					echo "<td class='tdimpar' style='text-align:center; height:50px;' colspan='9'>No hay datos para mostrar.</td>"; 
					echo "</tr>";
					echo "</table>";
				}
				else {
					$i=0;
					foreach ($datosAves as $ave) {
						echo "<div class='fichaave'>";
					    echo "<table cellpadding='2' cellspacing='2'>";
						echo "<tr valign='top'>";
						echo "<td>";
						echo "<table id='tab' cellpadding='0' cellspacing='0'>";
		
						if ($ave['imagen'] == 0)
							echo "<tr><td><img src='images/nodisponible.jpg' border='0'/></td></tr>";
						else
							echo "<tr><td><img src='thumbs/tn_".$ave['idAve'].".jpg' border='0'/></td></tr>";
		
				 		echo "<tr>";
						echo "<td><img src='images/money.png' border='0'/>&nbsp;".$ave['precio']."</td>";
					 	echo "</tr>";
				 		echo "<tr>";
						echo "<td><img src='images/phone.png' border='0'/>&nbsp;".$ave['telefono']."</td>";
					 	echo "</tr>";
				 		echo "<tr>";
						echo "<td><img src='images/email.png' border='0'/>&nbsp;<a href='mailto:".$ave['email']."'>".$ave['email']."</a></td>";
					 	echo "</tr>";
						echo "</table>";
						if ($i%2 == 0) echo "<td class='tdimpar'>"; else echo "<td class='tdpar'>";						
						echo "<table id='tabave' cellpadding='0' cellspacing='0'>";
						echo "<tr>";
						echo "<td>Nombre</td><th>".$ave['nombre']."</th>";
		  			 	echo "</tr>";
					  	echo "<tr>";
						echo "<td>Nombre cient&iacute;fico</td><th>".$ave['nombreCientifico']."</th>";
					 	echo "</tr>";
			  			echo "<tr>";
						echo "<td>Alimentaci&oacute;n</td><th>".$ave['alimentacion']."</th>";
			 	 		echo "</tr>";
				 		echo "<tr>";
						echo "<td>Madurez Sexual</td><th>".$ave['madurezSexual']."</th>";
					 	echo "</tr>";
						echo "<tr>";
						echo "<td>Ficha completa</td>";
						echo "<td>";
						echo "<a  href='#' onClick=\"showPopWin('fichapublica.php?idAve=".$ave['idAve']."',700,450,returnRefresh);\"><img alt='Ver ficha completa del ave' border='0' src='images/verFicha.gif' width='16' height='16' /></a>";				
						echo "</td>";
						echo "</tr>";
						echo "</table>";
						echo "</table>";
						echo "</div>";
						$i++;
					} // fin foreach
				} // fin si
			  ?>
</div>
<?php include("common/pie.php"); ?>
